export let comment_like = {
  namespaced: true,
  state: {
    comment_like_flag: 0
  },
  actions: {
    getCommentLike(store, data = {}) {
      let url = "/comment/like?id=" + data.id + "&cid=" + data.cid + "&t=" + data.t + "&type=" + data.type + "&timestamp=" + new Date().getTime();
      let t = data.t;
      return new Promise((resolve, reject) => {
        axios.get(url).then(({
          data
        }) => {
          store.commit('setCommentLike', t);
          resolve(data)
        }).catch((error) => {
          if (error.response) {
            reject(error.response.data);
          }
        });
      });
    }
  },
  mutations: {
    setCommentLike(state, data) {
      state.comment_like_flag = data;
    }
  }
}
